#ifndef FRAMESHOWER_H
#define FRAMESHOWER_H

#include <QWidget>
#include <QGraphicsView>
#include <QLayout>
#include "ImageScene.h"
#include <memory>

class FrameShower : public QWidget
{
Q_OBJECT
public:
    explicit FrameShower(QWidget* parent = nullptr);
    ~FrameShower() override;

public slots:
    void OnMcsUpdate();

public:
    void SetFrame(std::unique_ptr<QImage> image);
    void SetSrcFrameSize(const QSize& size);

private:
    QGraphicsView* frameView;
    ImageScene* frameScene;
    QLayout* layout;

private:
    QSize srcFrameSize;
    QSize bestFrameSize;
    QPixmap frame;

private:
    void resizeEvent(QResizeEvent *event) override;
    void GetBestFrameSize();
    void ResizeFrame();
    void PutFrameOnView();

};


#endif //FRAMESHOWER_H
